<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>双重for循环</title>
</head>

<body>
    <script>
        //1.我们可以把里面的循环看作是外层循环的语句
        //2.外层循环循环一次，内循环执行全部
        for (var i = 1; i <= 3; i++) {
            console.log('----外循环了' + i + '次');
            for (var j = 1; j <= 3; j++) {
                console.log('内循环了' + j + '次')
            }
        }
        // 外循环执行1次内循环就要执行3次


        // 打印五行五列的※  
        var str = '';
        for (var i = 1; i <= 5; i++) {
            //外层负责打印5行
            for (var j = 1; j <= 5; j++) {
                //内层负责一行打印5个
                str += '❖';
            }
            str += '\n';
        }
        console.log(str)
    </script>
</body>

</html>